﻿@using System.Data
@using LiuYan.Web.Areas.Mall.Controllers
@{
    Layout = null;
    Layout = "~/Areas/Mall/Views/Shared/MallLayout.cshtml";
    DataTable table = ViewData["goodsort"] as DataTable;
    ViewBag.Title = "今日折扣";
}
   

<div class="search">
    <div class="search_l">
        <input type="text" id="s_text" />
    </div>
    <div class="search_r">
        <img src="/Images/seach.jpg" onclick="search()" />
    </div>
</div>
@{
    foreach (DataRow row in table.Rows)
    {
        <div class="fl_l">
            <label>@row["Name"]</label>
          
        </div>


        <div class="goodlist">
            @{
        var goodstable = new DiscountController().GetDGoods(Convert.ToInt32(row["Id"]));
        foreach (DataRow row1 in goodstable.Rows)
        {
            var price = 0.0;
            if (row1["DiscountPrice"].ToString() != "")
            {
                price = Convert.ToDouble(row1["DiscountPrice"]) == 0 ? Convert.ToDouble(row1["Price"]) : Convert.ToDouble(row1["DiscountPrice"]);
            }
            <a href="@Url.Action("GoodDetail","Goods",new {gid=row1["Id"]})">
                <img src="@row1["Img1"]" />
                <label>@row1["Name"]</label><br />
                <label class="goodsprice">￥@price</label>&nbsp;&nbsp;
                <label>销量： @Html.Raw(Convert.ToInt32(row1["PayCountTrue"]) + Convert.ToInt32(row1["PayCount"]))  </label>
            </a>
        }
            }

        </div>
    }
}

<div style="width: 100%;height: 80px;"></div>

<script>
    function search() {
        var str = $("#s_text").val();
        if (str == "") {
            alert("请输入商品名称！");
            return false;
        }
        location.href = "@Url.Action("Index","Search")?str=" + encodeURIComponent(str);
    }
</script>